<!DOCTYPE html>
<html>
<head>
    <title>新建文章</title>
    {% include 'admin/common/header.html' %}
</head>
<body>


                        <ul id="categoryul"  class="dtree" data-id="0" >
                        </ul>

{% include 'admin/common/footer.html' %}
<script>
    layui.use(['jquery' ,'dtree'], function () {
        let form = layui.form
        let dtree=layui.dtree
        let $ = layui.jquery
        let MODULE_PATH="/admin/category/"
    let selectid='10';
   let cate= dtree.renderSelect({
      elem: '#categoryul',
       initLevel: "4",
          url: '/admin/category/tree',
          method: 'get',
          icon:'4',
          selectInputName: { nodeId: 'categoryid', context: 'categoryname' },
          //skin: 'layui',
          dataFormat: 'list',
          none: "暂时没有分类数据",
          selectTips: "在此选择文章分类",
      response: { treeId: 'categoryId', parentId: 'parentId', title: 'categoryName' },
       done: function(result, $ul, first){//只显示文章分类下的所有分类
                //console.log(result,first)
                // 设置第一个分类禁用后搜索显示想显示的总分类
                if(result.data.length>0) {
                    result.data.forEach(function (e) {
                        let childlist = cate.queryListTreeByPid(e.categoryId, result.data);
                        if (childlist.length > 0) {
                            cate.setDisabledNodes(e.categoryId);
                        }
                    });
                    cate.searchNode('文章分类');
                }
                    //cate.dataInit("10");
            },
      selectInitVal: 10
    })
    })
</script>
</body>
</html>